<?php
class Request{
    public static function post($key){
        if(self::hasPostKey($key)){
            $value=$_POST[$key];
            if (get_magic_quotes_gpc()) {
                $value = stripslashes($value);
            }
            return $value;
        }
        else{
            return "";
        }
    }
    public static function hasPostKey($key){
        return array_key_exists($key,$_POST);
    }
    public static function get($key){
        if(self::hasGetKey($key)){
            return $_GET[$key];
        }
        else{
            return "";
        }
    }
    public static function hasGetKey($key){
        return array_key_exists($key,$_GET);
    }
    public static function isPost(){
        return $_SERVER["REQUEST_METHOD"]=="POST";
    }
    public static function getMethod(){
        return $_SERVER["REQUEST_METHOD"];
    }
    public static function getValue($key){
        if(self::getMethod()=="POST"){
            return self::post($key);
        }
        return self::get($key);
    }
    public static function getReferer(){
    	return $_SERVER["HTTP_REFERER"];
    }
    public static function getUrl(){
    return $_SERVER["REQUEST_URI"];
    }
    public static function getUserIP(){
    return $_SERVER["REMOTE_ADDR"];
    }
}